package com.example.demo.request;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Email;
import javax.validation.constraints.Size;
import javax.validation.constraints.Pattern;


public class CreateUserRequest {
    @NotBlank(message = "统一认证号不能为空")
    @Size(min = 3, max = 20, message = "统一认证号长度必须在3-20个字符之间")
    @Pattern(regexp = "^[a-zA-Z0-9_]+$", message = "统一认证号只能包含字母、数字和下划线")
    private String authId; // 统一认证号

    @NotBlank(message = "用户名不能为空")
    @Size(min = 2, max = 50, message = "用户名长度必须在2-50个字符之间")
    private String userName; // 中文名

    @NotBlank(message = "邮箱不能为空")
    @Email(message = "邮箱格式不正确")
    @Size(max = 100, message = "邮箱长度不能超过100个字符")
    private String email; // 邮箱

    public String getAuthId() {
        return authId;
    }

    public void setAuthId(String authId) {
        this.authId = authId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getDeptId() {
        return deptId;
    }

    public void setDeptId(Integer deptId) {
        this.deptId = deptId;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public String getUserType() {
        return userType;
    }

    public void setUserType(String userType) {
        this.userType = userType;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @NotNull(message = "部门信息不能为空")
    private Integer deptId; // 所属部门ID

    @NotBlank(message = "所属部门不能为空")
    @Size(min = 2, max = 50, message = "部门名称长度必须在2-50个字符之间")
    private String deptName; // 所属部门中文名

    @NotBlank(message = "用户类型不能为空")
    @Pattern(regexp = "^(用户|管理员)$", message = "用户类型必须是：用户、管理员中的一种")
    private String userType; // 用户类型，如开发、测试、运维等

    @NotBlank(message = "密码不能为空")
    @Size(min = 6, max = 20, message = "密码长度必须在6-20个字符之间")
    @Pattern(regexp = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d@$!%*?&]{6,}$", message = "密码必须包含至少一个大写字母、一个小写字母和一个数字")
    private String password; // 密码
}